# cmake 版本指定
cmake_minimum_required(VERSION 3.20.0)

# 项目名
project(LuaGuiAndroid)

# 设置C++版本
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED true)

# LuaGui 根目录
set(LUAGUI_ROOT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../../../../../..)
# 指定平台
set(ADNROID TRUE)
# 指定库引入方式
set(PREBUILT_LIBS_DIRECTORY ${LUAGUI_ROOT_DIRECTORY}/libs/android/arm64-v8a)
# 指定资源目录
set(LUAGUI_ASSET_DIRECTORY app)
# 指定脚本目录
set(LUAGUI_SCRIPT_DIRECTORY ${LUAGUI_ASSET_DIRECTORY}/scripts)
# 指定字体路径
set(LUAGUI_FONT_FILEPATH  ${LUAGUI_ASSET_DIRECTORY}/fonts/DroidSansFallback.ttf)
# 指定日志文件路径
set(LUAGUI_LOG_FILEPATH log.txt)

# 拷贝文件
set(ANDROID_ASSETS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../assets/app)
#execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${ANDROID_ASSETS_DIRECTORY})
#execute_process(COMMAND ${CMAKE_COMMAND} -E copy_directory ${LUAGUI_ROOT_DIRECTORY}/src/scripts ${ANDROID_ASSETS_DIRECTORY}/scripts)
#execute_process(COMMAND ${CMAKE_COMMAND} -E copy_directory ${LUAGUI_ROOT_DIRECTORY}/assets/fonts ${ANDROID_ASSETS_DIRECTORY}/fonts)

# 引入LUAGUI库
add_subdirectory(${LUAGUI_ROOT_DIRECTORY}/src LuaGui)

# 生成动态库
add_library(${PROJECT_NAME} SHARED main.cpp AndroidApplication.cpp)
target_link_libraries(${PROJECT_NAME} LuaGui z GLESv1_CM GLESv2 OpenSLES log android)


